package com.zxj.schoolxianyu.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zxj.schoolxianyu.dao.userRegisteDao;
import com.zxj.schoolxianyu.entity.userRegiste;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userLoginService {

    @Autowired(required = false)
    private userRegisteDao userRegisteDao;

    public String Login(userRegiste user) {
        EntityWrapper<userRegiste> wrapper = new EntityWrapper<>();
        wrapper.eq("username", user.username);
        wrapper.eq("password", user.password);
        List<userRegiste> list = userRegisteDao.selectList(wrapper);
        if (list.isEmpty()) {
            return "wrong user name or password";
        } else {
            return "success";
        }
    }
}
